require 'socket'
 
host = '192.168.1.4'		# The web server
port = 8080			# Default HTTP port
path = "/index.html"		# The file we want 

# This is the HTTP request we send to fetch a file


# ACTUALIZAR ARCHIVO
=begin
request = "GET_UVG #{path} HTTP/1.1" << "\r\n"
request << "Host: servidor/8080" << "\r\n"
request << "Action: update_file" << "\r\n"
request << "Name: archivito" << "\r\n"
request << "File: mua-ha-ha!:P" << "\r\n"
request << "\r\n"
=end

# PREGUNTAR POR DOWNTIME
#=begin
request = "GET_UVG #{path} HTTP/1.1" << "\r\n"
request << "Host: servidor/8080" << "\r\n"
request << "Action: ask_downtime\n\nblabla\njejeje\n" << "\r\n"
request << "\r\n"
#=end

# CREAR UN USUARIO
=begin
request = "GET_UVG #{path} HTTP/1.1" << "\r\n"
request << "Host: servidor/8080" << "\r\n"
request << "Action: ask_create_user" << "\r\n"
request << "User: QWxhZGRpbjpvcGVuIHNlc2FtZQ==" << "\r\n"
request << "\r\n"
=end

# CONFIRMAR CREAR UN USUARIO
=begin
request = "GET_UVG #{path} HTTP/1.1" << "\r\n"
request << "Host: servidor/8080" << "\r\n"
request << "Action: go_delete_user" << "\r\n"
request << "User: QWxhZGRpbjpvcGVuIHNlc2FtZQ==" << "\r\n"
request << "\r\n"
=end

socket = TCPSocket.open(host,port)  # Connect to server
socket.print(request)               # Send request
response = socket.read              # Read complete response

# Split response at first blank line into headers and body

print ".#{response}."

#headers,body = response.split("\r\n\r\n", 2) 
#print body                          # And display it

